package com.design.calculate;

import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
/**
 * Spring 解释器模式
 * @author:         cong zhi
 * @createDate:     2023/7/18 15:44
 * @updateUser:     cong zhi
 * @updateDate:     2023/7/18 15:44
 * @updateRemark:   修改内容
 * @version:        v1.0
 */
public class SpringTest {

    public static void main(String[] args) {


        ExpressionParser parser = new SpelExpressionParser();
        Expression expression = parser.parseExpression("100 * 2 + 400 * 1 + 66");
        Integer result = (Integer) expression.getValue();
        System.out.println("计算结果是：" + result);

    }
}
